package qgs.zisu.javaconcurrency.javaconcurrency.testDXC;

import java.util.List;

/**
 * @Author: 蔡翔
 * @Date: 2019/9/6 9:12
 * @Version 1.0
 */
public class TestThread extends Thread {
    private final List<Integer> listInteger1;
    private final List<Integer> listInteger2;
    private final List<Integer> listInteger3;
    private final List<Integer> listInteger4;
    private final List<Integer> listInteger5;
    private final List<Integer> listInteger6;
    private final List<Integer> listInteger7;
    private final List<Integer> listInteger8;
    private final List<Integer> listInteger9;
    private final List<Integer> listInteger10;

    private Integer sum1 = 0;
    private Integer sum2 = 0;
    private Integer sum3 = 0;
    private Integer sum4 = 0;
    private Integer sum5 = 0;
    private Integer sum6 = 0;
    private Integer sum7 = 0;
    private Integer sum8 = 0;
    private Integer sum9 = 0;
    private Integer sum10 = 0;
    public TestThread(List<Integer> listInteger1, List<Integer> listInteger2,List<Integer> listInteger3, List<Integer> listInteger4,List<Integer> listInteger5, List<Integer> listInteger6,List<Integer> listInteger7, List<Integer> listInteger8, List<Integer> listInteger9, List<Integer> listInteger10){
        this.listInteger1 = listInteger1;
        this.listInteger2 = listInteger2;
        this.listInteger3 = listInteger3;
        this.listInteger4 = listInteger4;
        this.listInteger5 = listInteger5;
        this.listInteger6 = listInteger6;
        this.listInteger7 = listInteger7;
        this.listInteger8 = listInteger8;
        this.listInteger9 = listInteger9;
        this.listInteger10 = listInteger10;
    }


    @Override
    public void run() {
        int temp = 0;
        for(Integer i :listInteger1){
            for(Integer j : listInteger2){
                temp = i-j;
                if(temp>0){
                    sum1 += temp;
                }
            }
        }
        temp = 0;
        for(Integer i :listInteger1){
            for(Integer j : listInteger3){
                temp = i-j;
                if(temp>0){
                    sum2 += temp;
                }
            }
        }
        temp = 0;
        for(Integer i :listInteger1){
            for(Integer j : listInteger4){
                temp = i-j;
                if(temp>0){
                    sum3 += temp;
                }
            }
        }
        temp = 0;
        for(Integer i :listInteger1){
            for(Integer j : listInteger5){
                temp = i-j;
                if(temp>0){
                    sum4 += temp;
                }
            }
        }
        temp = 0;
        for(Integer i :listInteger1){
            for(Integer j : listInteger6){
                temp = i-j;
                if(temp>0){
                    sum5 += temp;
                }
            }
        }
        temp = 0;
        for(Integer i :listInteger1){
            for(Integer j : listInteger7){
                temp = i-j;
                if(temp>0){
                    sum6 += temp;
                }
            }
        }
        temp = 0;
        for(Integer i :listInteger1){
            for(Integer j : listInteger8){
                temp = i-j;
                if(temp>0){
                    sum7 += temp;
                }
            }
        }
        temp = 0;
        for(Integer i :listInteger1){
            for(Integer j : listInteger9){
                temp = i-j;
                if(temp>0){
                    sum8 += temp;
                }
            }
        }
        temp = 0;
        for(Integer i :listInteger1){
            for(Integer j : listInteger10){
                temp = i-j;
                if(temp>0){
                    sum9 += temp;
                }
            }
        }

    }

    public Integer getSum(){
        return this.sum1+this.sum2+this.sum3+this.sum4+this.sum5+this.sum6+this.sum7+this.sum8+this.sum9+this.sum10;
    }
}
